package com.ywjg.serviceimp;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ywjg.dao.CheckDiyDao;
import com.ywjg.model.CheckDiy;
import com.ywjg.service.ICheckDiyService;
import com.ywjg.utils.Utils;
@Service
public class CheckDiyService implements ICheckDiyService {
    @Resource
	CheckDiyDao checkDiyDao;
	
	
	
	/* (non-Javadoc)
	 * @see com.ywjg.serviceimp.ICheckDiyService#upDateDiyInf(com.ywjg.model.CheckDiy)
	 */
	public CheckDiy upDateDiyInf(CheckDiy c) {
		CheckDiy checkDiy = checkDiyDao.findOne(c.getId());
		Utils.copyPropertiesIgnoreNull(c, checkDiy);
		return checkDiyDao.save(checkDiy);
	}

	/* (non-Javadoc)
	 * @see com.ywjg.serviceimp.ICheckDiyService#getCheckDiyInf(java.lang.Integer)
	 */
	public CheckDiy getCheckDiyInf(Integer userId) {
		// TODO Auto-generated method stub
		return checkDiyDao.findByappUserId(userId);
	}
	
	/* (non-Javadoc)
	 * @see com.ywjg.serviceimp.ICheckDiyService#getAllCheckDiyInf()
	 */
	public List<CheckDiy> getAllCheckDiyInf() {
		return checkDiyDao.findAll();
	}
	
	

	/* (non-Javadoc)
	 * @see com.ywjg.serviceimp.ICheckDiyService#addCheckDiyInf(com.ywjg.model.CheckDiy)
	 */
	public CheckDiy addCheckDiyInf(CheckDiy checkDiy) {
		// TODO Auto-generated method stub
		return checkDiyDao.save(checkDiy);
	}
	
}
